<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-for</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <!-- 绑定数据到数组来渲染一个列表,sites 是源数据数组并且 site 是数组元素迭代的别名-->
    <div id="ap">
    <ul>
        <template  v-for="site in sites">
            <li>
                {{site.name}}
            </li> 
        </template>
    </ul>
    <!-- sites可以是对象-->
    <ul>
        <!-- <li v-for="site in object"> 
            {{site}}
        </li> -->
        <!-- <li v-for="(value,key) in object">
            {{key}}:{{value}}
        </li> -->
        <li v-for="(value,key,index) in object">
            {{index}}.{{key}}:{{value}}
        </li>
    </ul>
</div>
</body>
<script>
    new Vue({
        el:'#ap',
        data:{
            sites:[
                {   name:'na' },
                {   name:'maje' },
                {   name:'jj' }
            ],
            object:{
                name: '菜鸟教程',
                url: 'http://www.runoob.com',
                slogan: '学的不仅是技术，更是梦想！'
            }
        }
    })
</script>
</html>